Skip to content

toolchains: fix MSVC rc.exe invocation#51151

Merged
BillyONeal merged 1 commit intomicrosoft:masterfrom
rkitover:fix-rc-invocation
Apr 15, 2026
Merged

toolchains: fix MSVC rc.exe invocation#51151
BillyONeal merged 1 commit intomicrosoft:masterfrom
rkitover:fix-rc-invocation

Conversation

@rkitover
Copy link
Copy Markdown
Contributor

Change -c65001 in CMAKE_RC_FLAGS, which some versions of rc.exe apparently throw an invalid invocation error on to /c65001 which works fine.

Change `-c65001` in `CMAKE_RC_FLAGS`, which some versions of `rc.exe`
apparently throw an invalid invocation error on to `/c65001` which works
fine.

Signed-off-by: Rafael Kitover <[email protected]>
Copy link
Copy Markdown
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@BillyONeal BillyONeal enabled auto-merge (squash) April 13, 2026 22:02
@BillyONeal BillyONeal merged commit d7b75fa into microsoft:master Apr 15, 2026
16 checks passed
@dg0yt
Copy link
Copy Markdown
Contributor

dg0yt commented Apr 18, 2026

I would like to have seen a reference to an actual report or documentation.
There are issues which look like rc but are triggered by using a wrong cmake.
And there are cases where flags are passed through the msys environment which might heuristically determine that /c65001 is an absolute POSIX path which must be converted to a Windows path.

@rkitover rkitover deleted the fix-rc-invocation branch April 18, 2026 17:29
@rkitover
Copy link
Copy Markdown
Contributor Author

Hi Kai.

I don't exactly know what or where the problem was, but it was fixed with this change. I am using the latest Visual Studio 2026.

I don't see any problems building ports that use MSYS2. Do you know of any that may be problematic? I'll be happy to fix any issues. This would only happen with commands being executed by MSYS2's sh.exe, e.g. from make.

@dg0yt
Copy link
Copy Markdown
Contributor

dg0yt commented Apr 18, 2026

It seems really strange to me that the toolchain files are "fixed" without knowing "what or where the problem was". Such changes invalidate everybody's cached artifacts.

In vcpkg CI, there were no problems with msys2 based ports before and after this PR.

Just FTR - but probably unrelated - the issues with msys2 mingw cmake and VS rc.exe look like #49203.
Search for RC1107:
https://github.com/microsoft/vcpkg/issues?q=is%3Aissue%20state%3Aopen%20%22RC1107%22

@BillyONeal
Copy link
Copy Markdown
Member

BillyONeal commented Apr 21, 2026

@dg0yt I'm sorry, the change looked plausible to me but I agree we should probably be more specific about a "demonstrate the before/after fix". (There are a lot of Windows tools that require /arg rather than -arg or --arg and I could easily imagine some versions of rc.exe having such limitations... the resource compiler is very old and dates back to at least the mid 90s. And our build lab has recent-ish tools where I could imagine that would be changed)

@rkitover
Copy link
Copy Markdown
Contributor Author

I had this problem and it was definitely the problem, because rc.exe was throwing an error and my builds were failing, and once I changed the option to the slash form they were no longer failing.

It's possible some government person was doing something to my toolchain and they have some version of rc.exe that does not work with the dash form. My build log files have been deleted, which makes this more likely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants